
export interface IAction {
	type: string
	payload: any
}

export interface IUser {
	nickname: string
	avatar: string,
	id: string
}

export interface IState {
	list: IUser[]
}

const initState = {
	list: [{
		nickname: '张三',
		avatar: '图片',
		id: '1'
	}]
}


const reducer = (state: IState = initState, action: IAction) => {
	switch (action.type) {
		case 'SET_LIST':
			return {
				...state,
				list: action.payload
			}
		case 'ADD_LIST':
			return {
				...state,
				list: [...state.list, action.payload]
			}
		default:
			return state
	}

}


export default reducer